package com.generics;

import java.util.ArrayList;
import java.util.Objects;

public class TEXT {
    //1.泛型,确定范围
    public static void main(String[] args) {
        ArrayList<String>list=new ArrayList<>();
        list.add("吴智海1");
        list.add("吴智海2");
        list.add("吴智海3");

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }

        //MyArrayList
        MyArrayList<String,String>list1=new MyArrayList<>();
        list1.add("2");
        list1.add("1");

        //通配符？
        //泛型编译后会被擦除
        //泛型不支持基本类型，单可以用对象类型（应用数据类型）
        boolean s=Objects.equals(list1.get(1),list1.get(2));//安全，可靠,做了非空校验
        Integer A=12;//自动装箱
        Integer a=Integer.valueOf(012);

        StringBuilder rs=new StringBuilder();
        //1.StringBuilder演示,效率更高
        for (int i = 0; i < 20; i++) {
            rs.append("abc");
        }
        System.out.println(rs);
    }


}

